import java.util.ArrayList;
import java.util.List;

public class Solution1023 {
    public List<Boolean> camelMatch(String[] queries, String pattern) {
        List<Boolean> ans=new ArrayList<>();
        char[] chars=pattern.toCharArray();
        for (String query : queries) {
            int i=0,j=0;
            boolean flag=true;
            while (i<query.length() && j<chars.length){
                if (query.charAt(i)==chars[j]){
                    i++;
                    j++;
                }else {
                    if (query.charAt(i)>='a' && query.charAt(i)<='z'){
                        i++;
                    }else {
                        flag=false;
                        break;
                    }
                }
            }
            while (i<query.length() && query.charAt(i)>='a' && query.charAt(i)<='z'){
                i++;
            }
            if (flag && i==query.length() && j==chars.length){
                ans.add(true);
            }else {
                ans.add(false);
            }
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1023().camelMatch(new String[]{"FooBar","FooBarTest","FootBall","FrameBuffer","ForceFeedBack"},"FoBa"));
    }
}
